package com.chainyoung.component_tmmarket.mvp.model;

import com.chainyoung.common.bean.UserInfo;
import com.chainyoung.common.di.scope.FragmentScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmmarket.api.MarketService;
import com.chainyoung.component_tmmarket.bean.MarketList;
import com.chainyoung.component_tmmarket.mvp.contract.MarketMainContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;


public class MarketMainModel extends BaseModel implements MarketMainContract.Model{

   @Inject
    public MarketMainModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }


    @Override
    public Flowable<MarketList> getMarketCurrencys() {
        return mRepositoryManager.obtainRetrofitService(MarketService.class)
                .getMarketCurrencys()
                .compose(RxUtils.<MarketList>handleResult());

    }

    @Override
    public Flowable<UserInfo> getUserInfo(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(MarketService.class)
                .getUserInfo(map)
                //.compose(RxUtils.<BaseResponse<UserInfo>>rxSchedulerHelper())
                .compose(RxUtils.<UserInfo>handleResult());
    }


}
